package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreGroup;
import com.fujitsu.nanjing.tieba.ibator.CoreGroupCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreGroupDAOImpl extends SqlMapClientDaoSupport implements CoreGroupDAO {

    public CoreGroupDAOImpl() {
        super();
    }

    public int countByExample(CoreGroupCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_group.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreGroupCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_group.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(String groupid) {
        CoreGroup _key = new CoreGroup();
        _key.setGroupid(groupid);
        int rows = getSqlMapClientTemplate().delete("core_group.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreGroup record) {
        getSqlMapClientTemplate().insert("core_group.insert", record);
    }

    public void insertSelective(CoreGroup record) {
        getSqlMapClientTemplate().insert("core_group.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreGroup> selectByExample(CoreGroupCriteria example) {
        List<CoreGroup> list = getSqlMapClientTemplate().queryForList("core_group.selectByExample", example);
        return list;
    }

    public CoreGroup selectByPrimaryKey(String groupid) {
        CoreGroup _key = new CoreGroup();
        _key.setGroupid(groupid);
        CoreGroup record = (CoreGroup) getSqlMapClientTemplate().queryForObject("core_group.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreGroup record, CoreGroupCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_group.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreGroup record, CoreGroupCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_group.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreGroup record) {
        int rows = getSqlMapClientTemplate().update("core_group.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreGroup record) {
        int rows = getSqlMapClientTemplate().update("core_group.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreGroupCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreGroupCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}